/**
 * Implementacion de la clase GraphFactory.
 */

#include "graphFactory.hpp"


void GraphFactory::validateSizeGraph(Logger *logger)
{
    if (this->xMax == INT_MIN){
        logger->reportErrorMessage("graphFactory","validateSizeGraph","El tamanio en x maximo del grafo no ha podido ser determinada");
    }
    if (this->yMax == INT_MIN){
        logger->reportErrorMessage("graphFactory","validateSizeGraph","El tamanio en y maximo del grafo no ha podido ser determinado");
    }
    if (this->xMin == INT_MAX){
        logger->reportErrorMessage("graphFactory","validateSizeGraph","El tamanio en x minimo del grafo no ha podido ser determinado");
    }
    if (this->yMin == INT_MAX){
        logger->reportErrorMessage("graphFactory","validateSizeGraph","El tamanio en y minimo del grafo no ha podido ser determinado");
    }
}
    

GraphFactory::GraphFactory(std::string &fileToParseN, std::string &fileToParseE,std::string &fileToParseO,
						   Logger *logger, Graph * graph)
{
	this->graph = graph;
    this->xMax = this->nodeValidator.getXMax();
    this->xMin = this->nodeValidator.getXMin();
    this->yMax = this->nodeValidator.getYMax();
    this->yMin = this->nodeValidator.getYMin();
    this->validateSizeGraph(logger);
	
	this->nodeValidator.create(fileToParseN,logger,(this->graph));
	this->edgeValidator.create(fileToParseE,logger,(this->graph));
	this->objectValidator.create(fileToParseO,logger,(this->graph));

}

GraphFactory::~GraphFactory() {

}

void GraphFactory::generateGraph()
{
	this->nodeValidator.validate();
	this->edgeValidator.validate();
	this->objectValidator.validate();
}

int GraphFactory::getXMax(){
    return this->xMax;
}

int GraphFactory::getYMax(){
    return this->yMax;
}

int GraphFactory::getXMin(){
    return this->xMin;
}

int GraphFactory::getYMin(){
    return this->yMin;
}

